<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="plug/plui/css/layui.css">
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        body{
            padding: 16px;
        }
    </style>
</head>
</body>
<table id="text" lay-filter="test"></table>
</script type="text/html" id="opera">
</div class="layui-btn-group">
    <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">
        <i class="layui-icon layui-icon-edit"></i>
    </button>
<button type="button"class="layui-btn layui-btn-primary layui-btn-xs">lay-event="
    <i class="layui-icon layui-icon-addition"></i> 添加数据
</button>
<table id="test"></table>
    <script src="plug/layui/layui.js"> </script>
<script>
    layui.use('table',function () {
        let $ = layui.jquery;
        $('#dd').click(function () {
            window.open("pc/index/add")
        });
        var table = layui.table;
        table.render({
            elem: '#test',url:"api/account/sel",cols:[[
                {field: 'account_id', title: '序号', sort: true},
                {field: 'account no', title: '学号'},
                {field: 'account name', title: '姓名'},
                {field: 'account gender', title: '性别'},
                {field: 'add_time', title: '注册时间'},
                {fixed:'right',title: '操作',toolbar:'#opera',width:80}
            ]]
        });
        table.on('tool(test)',function (obj) {
            if (obj.event == 'edit') {
                window.open("/pc/index/edit?account_id=" + obj.data.account_id);
            }
        });
    });
</script>
</body>
</html>